package safari.model.free;

import java.sql.SQLException;
import java.util.List;

import org.mybatis.spring.SqlSessionTemplate;

public class FreeBoardDaoImpl implements FreeBoardDao {
	private SqlSessionTemplate sqlSessionTemplate;
	public FreeBoardDaoImpl(SqlSessionTemplate sqlSessionTemplate){
		this.sqlSessionTemplate = sqlSessionTemplate;
	}
	
	@Override
	public void freeBoardRegister(FreeBoardVO fvo) throws SQLException {
		sqlSessionTemplate.insert("free.freeBoardRegister", fvo);
	}

	@Override
	public void freeBoardUpdate(FreeBoardVO fbvo) throws SQLException {
		sqlSessionTemplate.update("free.freeBoardUpdate", fbvo);
		
	}
	@Override
	public FreeBoardVO freeBoardUpdateView(int no) throws SQLException {
		return sqlSessionTemplate.selectOne("free.freeBoardUpdateView", no);
	}

	@Override
	public void freeBoardDelete(int no) throws SQLException {
		sqlSessionTemplate.delete("free.freeBoardDelete", no);
		
	}

	@Override
	public FreeBoardVO freeBoardShowContent(int no) throws SQLException {
		return sqlSessionTemplate.selectOne("free.freeBoardShowContent", no);
	}

	@Override
	public void freeBoardUpdateHits(int no) throws SQLException {
		// TODO Auto-generated method stub
		
	}

	@Override
	public List<FreeBoardVO> freeBoardGetAllList(int no) throws SQLException {
		return sqlSessionTemplate.selectList("free.freeBoardGetAllList",no);
	}

	@Override
	public int freeBoardGetTotalContentCount() throws SQLException {
		return sqlSessionTemplate.selectOne("free.freeBoardGetTotalContentCount");
	}

	@Override
	public void freeBoardReplyRegister(FreeBoardVO fbvo) throws SQLException {
		sqlSessionTemplate.insert("free.freeBoardReplyRegister",fbvo);
	}
	@Override
	public FreeBoardVO freeBoardReplyView(int no) throws SQLException {
		return sqlSessionTemplate.selectOne("free.freeBoardReplyView", no);
	}

	@Override
	public void freeBoardReplyUpdate(FreeBoardVO fbvo) throws SQLException {
		sqlSessionTemplate.update("free.freeBoardReplyUpdate",fbvo);
		
	}

	@Override
	public void freeBoardReplyDelete(int no) throws SQLException {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void freeBoardCommentRegister(FreeBoardCommentVO fbcVO)
			throws SQLException {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void freeBoardCommentUpdate(FreeBoardCommentVO fbcVO)
			throws SQLException {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void freeBoardCommentDelete(int no) throws SQLException {
		// TODO Auto-generated method stub
		
	}

	@Override
	public List<FreeBoardVO> freeBoardSearchByTitleOrContent(String word)
			throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<FreeBoardVO> freeBoardSearchByTitle(String word)
			throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<FreeBoardVO> freeBoardSearchById(String word)
			throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

}
